// 存储 localStorage     setStore(key, val)  设置
export const setStore = (name, content) => {
  if (!name) return
  if (typeof content !== 'string') {
    content = JSON.stringify(content)
  }
  localStorage.setItem(name, content)
}

// 获取 localStorage     getStore(key)  获取
export const getStore = (name) => {
  if (!name) return
  return JSON.parse(localStorage.getItem(name))
}

// 删除 localStorage     removeStore(key)  删除
export const removeStore = (name) => {
  if (!name) return
  localStorage.removeItem(name)
}

// 清除 localStorage
export const clearStore = () => {
  localStorage.clear()
}